<template>
  <div class="message-input">
    <el-input
      v-model="inputText"
      type="textarea"
      :rows="3"
      placeholder="请输入您的问题..."
      resize="none"
      @keydown.enter.exact.prevent="sendMessage"
    />
    
    <div class="action-bar">
      <el-button type="primary" @click="sendMessage" :disabled="!inputText.trim()">
        发送
      </el-button>
      
      <div class="extra-actions">
        <el-tooltip content="上传文件" placement="top">
          <el-button circle>
            <el-icon><Upload /></el-icon>
          </el-button>
        </el-tooltip>
        
        <el-tooltip content="清除聊天" placement="top">
          <el-button circle @click="clearChat">
            <el-icon><Delete /></el-icon>
          </el-button>
        </el-tooltip>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { Upload, Delete } from '@element-plus/icons-vue'

const inputText = ref('')

const sendMessage = () => {
  if (!inputText.value.trim()) return
  
  // 发送消息逻辑
  console.log('发送消息:', inputText.value)
  
  // 清空输入框
  inputText.value = ''
}

const clearChat = () => {
  // 清除聊天记录逻辑
  console.log('清除聊天记录')
}
</script>

<style lang="scss" scoped>
.message-input {
  .el-textarea {
    margin-bottom: 10px;
    
    :deep(.el-textarea__inner) {
      border-radius: 8px;
      padding: 12px;
    }
  }
  
  .action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    
    .el-button {
      width: 80px;
    }
    
    .extra-actions {
      display: flex;
      gap: 8px;
      
      .el-button {
        width: 36px;
        height: 36px;
      }
    }
  }
}
</style>